import { BaseWindow } from "../../../component/window/BaseWindow";
import { ILayer } from "../../../mvc/interfaces/ILayer";
import { Language } from "../../../../extend/language/Language";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { Cache } from "../../cache/Cache";
import { GameConst } from "../../../component/gconst/GameConst";
import { ObjCreate } from "../common/ObjCreate";
import { RadioButtonGroup } from "../../../../fl/controls/RadioButtonGroup";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { ImagesConst } from "../../resource/ImagesConst";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { SecTimerView } from "../common/SecTimerView";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
import { GTextFiledBitmap } from "../../../../com/mui/controls/GTextFiledBitmap";
type int = number;
//class AttachedSoulMultiplicitySelectView
    
    export  class AttachedSoulMultiplicitySelectView extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            this._price = [Language.getString(28638), "10", "30"];
            titleHeight = 26;
            setSize(336, 330);
            title = Language.getString(28584);
            return;
        }

        /* internal  */onClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.income = this._radioGroup.selectedData as int;
            return;
        }

        /* internal  */onSecViewTimeOut(): void
        {
            this.income = 1;
            return;
        }

        /* internal  */set income(arg1: int)
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.AttachedSoulBattlefielGetIncome, arg1));
            return;
        }

        /* internal  */selectItem(arg1: Object /* flash.events.Event */): void
        {
            this._rewardTxt.htmlText = Language.getStringByParam(28641, this._reward * int(this._radioGroup.selectedData));
            return;
        }

        public set reward(arg1: int)
        {
            this._reward = arg1;
            this._rewardTxt.htmlText = Language.getStringByParam(28641, this._reward);
            this._tfLeftTime.setLeftTime(60);
            this._todaySpiritCoin.text = Language.getStringByParam(28642, Cache.instance.attachedSoulBattlefield.todaySpiritCoin, GameConst.SpiritCoinDailyMax);
            return;
        }

        protected /* override */ createDisposedChildrenImpl(): void
        {
            var loc6=null;
            super.createDisposedChildrenImpl();
            pushUIToDisposeVec(ObjCreate.createBg(18, 38, 300, 280, this));
            if (!this._radioGroup) 
            {
                this._radioGroup = new RadioButtonGroup("AttachedSoulMultiplicitySelectView");
                this._radioGroup.addEventListener(flash.events.Event.CHANGE, this.selectItem);
            }
            var loc1=ObjCreate.createGTextField("", 38, 55, 220, 100, this, GlobalStyle._textFormat2);
            loc1.multiline = true;
            loc1.wordWrap = true;
            loc1.htmlText = Language.getString(28637);
            pushUIToDisposeVec(loc1);
            pushUIToDisposeVec(ObjCreate.createBg(105, 90, 135, 24, this, ImagesConst.SelectedBg));
            this._rewardTxt = ObjCreate.createGTextField("", 130, 93, 220, 100, this, GlobalStyle._textFormat2);
            var loc2=0;
            while (loc2 < 3) 
            {
                (loc6 = ObjCreate.createRadioButton(Language.getString(28578 + loc2), 95, 155 + loc2 * 25, 100, 28, this, "GCheckBox")).value = loc2 + 1;
                loc6.selected = loc2 == 0;
                loc6.group = this._radioGroup;
                pushUIToDisposeVec(loc6);
                pushUIToDisposeVec(ObjCreate.createGTextField(this._price[loc2], 180, 159 + loc2 * 25, 220, 20, this));
                ++loc2;
            }
            var loc3=GlobalClass.getBitmap("Yuanbao");
            ObjCreate.setObjAttri(loc3, 198, 185, -1, -1, this);
            var loc4=GlobalClass.getBitmap("Yuanbao");
            ObjCreate.setObjAttri(loc4, 198, 210, -1, -1, this);
            this._tfLeftTime = new SecTimerView();
            this._tfLeftTime.mouseEnabled = false;
            this._tfLeftTime.setParse(Language.getString(28639));
            this._tfLeftTime.defaultTextFormat = GlobalStyle._textFormatRed;
            this._tfLeftTime.filters = [FilterConst.glowFilter];
            this._tfLeftTime.timeOutHandler = this.onSecViewTimeOut;
            this._tfLeftTime.mouseEnabled = false;
            ObjCreate.setObjAttri(this._tfLeftTime, 65, 295, 220, 20, this);
            this._todaySpiritCoin = ObjCreate.createGTextFiledBitmap("", 18, 235, 304, 20, this, GlobalStyle.setTextFormatAlign(GlobalStyle._textFormat2, flash.text.TextFormatAlign.CENTER));
            var loc5;
            (loc5 = ObjCreate.createGButton(Language.getString(28640), 123, 260, 90, 28, this, "ButtonRed")).configEventListener(flash.events.MouseEvent.CLICK, this.onClickHandler);
            pushUIToDisposeVec(loc5);
            return;
        }

        protected /* override */ disposeImpl(arg1: Boolean=true): void
        {
            super.disposeImpl(arg1);
            this._tfLeftTime.dispose(arg1);
            this._rewardTxt.dispose(arg1);
            this._todaySpiritCoin.dispose(arg1);
            this._tfLeftTime = null;
            this._rewardTxt = null;
            this._todaySpiritCoin = null;
            return;
        }

        /* internal */ /* var */_reward: int;

        /* internal */ /* var */_rewardTxt: GTextFiled;

        /* internal */ /* var */_todaySpiritCoin: GTextFiledBitmap;

        /* internal */ /* var */_tfLeftTime: SecTimerView;

        /* internal */ /* var */_radioGroup: RadioButtonGroup;

        /* internal */ /* var */_price: Array<any>;
    }
